package com.wandian.message.mvvm.sysmessage.messagedetail;

import android.os.Bundle;

import androidx.databinding.DataBindingUtil;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.mylib.libcore.config.RouterConfig;
import com.mylib.libcore.mvvm.BaseMVVMActivity;
import com.mylib.libcore.utils.JsonUtil;
import com.mylib.libcore.utils.StatusBarUtils;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.message.R;
import com.wandian.message.bean.SysMessageBean;
import com.wandian.message.databinding.MessageActivitySysMessageDetailBinding;

/**
 * @author Administrator
 * @date 2019/12/18-14:28
 * @description 消息详情
 **/
@Route(path = RouterConfig.ROUTER_ACTIVITY_SYS_MESSAGE_DETAILS)
public class MessageDetailActivity extends BaseMVVMActivity<MessageDetailActivityViewModel> {
    private MessageActivitySysMessageDetailBinding dataBinding;
    @Override
    public void init(Bundle savedInstanceState) {
        dataBinding = DataBindingUtil.setContentView(this, R.layout.message_activity_sys_message_detail);
        dataBinding.setLifecycleOwner(this);
        dataBinding.setViewModel(mViewModel);
        initViewData();
        initClink();
    }
    private void initViewData(){
        StatusBarUtils.with(this,false)
                .setIsActionBar(false)
                .clearActionBarShadow()
                .setDrawable(getResources().getDrawable(R.drawable.sys_color_two))
                .init();
        dataBinding.bindSysToolBar.toolBarTvTitle.setText("消息详情");
        String message_json = getIntent().getStringExtra("message_json")+"";
        SysMessageBean bean = (SysMessageBean) JsonUtil.parseJsonToBean(message_json,SysMessageBean.class);
        if(!UIUtils.isEmpty(bean)){
            dataBinding.tvMessageTitle.setText(bean.getNoticeTitle()+"");
            dataBinding.tvMessageContent.setText(bean.getNoticeContent()+"");
            dataBinding.tvMessageTime.setText(bean.getCreateTime()+"");
            dataBinding.tvMessageType.setText(bean.getNoticeType()+"");
        }

    }
    private void initClink(){
        dataBinding.bindSysToolBar.toolBarIvBack.setOnClickListener(v -> {
            finishhideSoftBoard();
            finish();
        });

    }

}
